﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Services.aspx.cs" Inherits="Sinacor.Infra.Tools.ServiceRegistration.Web.Services" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Cadastro de Serviços</title>
        <link href="../StyleSheet.css" rel="stylesheet" type="text/css" />
        <script src="../Scripts.js" type="text/javascript"></script>
    </head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManagerService" runat="server" OnAsyncPostBackError="ScriptManagerService_AsyncPostBackError" EnablePartialRendering="true" />

        <script type="text/javascript" language="javascript">
            Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

            function EndRequestHandler(sender, args) {
                if (args.get_error() != undefined && args.get_error().httpStatusCode == '500') {
                    var errorMessage = args.get_error().message
                    args.set_errorHandled(true);
                    alert(errorMessage);                    
                }
            }
        </script>
       
        <asp:UpdatePanel ID="UpdatePanelService" runat="server">
            <ContentTemplate>   
                              
                <div class="help">
                    <a href="../Help/ManualCadastroServico.mht" target="_blank"><img src="../Images/help.gif" alt="Help" border="0" /></a>
                </div>
                <table id="mainTable" align="left" cellpadding="10" cellspacing="10" border="0" class="table">
                    <tr style="height: 20%">
                        <td colspan="2" class="boder">
                            <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                <tr>
                                    <td style="width: 150;" class="title">Módulo</td>
                                    <td style="width: 150;" class="title">Sub-Módulo</td>
                                    <td style="width: 150;" class="title">Porta</td>
                                    <td style="width: 150;" class="title">Serviço</td>
                                    <td style="width: 150;" class="title">Método</td>
                                </tr>
                                <tr>
                                    <td style="width: 150;">
                                        <asp:DropDownList ID="ddlModule" runat="server" Width="150" AutoPostBack="True" OnSelectedIndexChanged="ddlModule_SelectedIndexChanged"></asp:DropDownList>
                                    </td>
                                    <td style="width: 150;">
                                        <asp:DropDownList ID="ddlSubModule" runat="server" Width="150" AutoPostBack="True"></asp:DropDownList>
                                    </td>
                                    <td style="width: 150;">
                                        <asp:TextBox ID="txtPort" runat="server" Width="150" MaxLength="5" onkeypress="Enter('5');" ></asp:TextBox>
                                        <asp:CompareValidator ID="cpvtxtPort" runat="server" ControlToValidate="txtPort" ErrorMessage="Valor da Porta inválido" Operator="DataTypeCheck" SetFocusOnError="True" Type="Integer" Display="None" ValidationGroup="Search"></asp:CompareValidator>
                                    </td>
                                    <td style="width: 150;">
                                        <asp:TextBox ID="txtService" runat="server" Width="150" MaxLength="50" onkeypress="Enter('5');" ></asp:TextBox>
                                    </td>
                                    <td style="width: 150;">
                                        <asp:TextBox ID="txtMethod" runat="server" Width="150" MaxLength="128" onkeypress="Enter('5');" ></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="height: 10px;" colspan="6">&nbsp;</td>
                                </tr>   
                                <tr>
                                    <td style="width: 250;" class="title">Descrição</td>
                                    <td style="width: 250;" class="title">Tabelas Relacionadas</td>
                                    <td style="width: 150;" class="title">Parâmetro</td>
                                    <td style="width: 150;" class="title">Tipo</td>
                                    <td style="width: 250;" colspan="3">
                                        <asp:CheckBox runat="server" ID="chkItemDivergent" Text="Itens Divergentes" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0">
                                            <tr>
                                                <td>
                                                    <asp:TextBox ID="txtDescription" runat="server" Width="250px" Rows="3" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('5');" ></asp:TextBox>    
                                                </td>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0">
                                                        <tr>
                                                            <td><asp:CheckBox runat="server" ID="chkService" Text="Serviço" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td><asp:CheckBox runat="server" ID="chkMethod" Text="Método" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td><asp:CheckBox runat="server" ID="chkParameter" Text="Parâmetro" /></td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtRelatedTables" runat="server" Width="250px" Rows="3" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('5');" ></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <asp:TextBox ID="txtParameter" runat="server" Width="150" MaxLength="128" onkeypress="Enter('5');" ></asp:TextBox>
                                    </td>
                                    <td style="vertical-align: top">
                                        <table cellpadding="0" cellspacing="0" border="0">
                                            <tr>
                                                <td>
                                                    <asp:TextBox ID="txtType" runat="server" Width="150" MaxLength="200" onkeypress="Enter('5');" ></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:CheckBox runat="server" ID="chkMethodType" Text="Método" />
                                                    <asp:CheckBox runat="server" ID="chkParameterType" Text="Parâmetro" />
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td colspan="3" style="text-align: right;">
                                        <asp:Button ID="btnClear" runat="server" Text="Limpar" Width="100" Style="vertical-align: top" OnClick="btnClear_Click" CausesValidation="false" />
                                        <asp:Button ID="btnSearch" runat="server" Text="Pesquisar" Width="100" Style="vertical-align: top" OnClick="btnSearch_Click" ValidationGroup="Search" />
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr style="height: 80%">
                        <td style="width: 20%; vertical-align: top" class="boder">
                            <div  id="divTreeView" class="divTreeView" runat="server">
                                <asp:TreeView ID="trvService" runat="server" 
                                    NodeIndent="20" ExpandDepth="1" ShowExpandCollapse="true"
                                    PopulateNodesFromClient="true" OnTreeNodePopulate="trvService_TreeNodePopulate"
                                    OnSelectedNodeChanged="trvService_SelectedNodeChanged">
                                    <NodeStyle ForeColor="#396EAA" HorizontalPadding="5" />
                                    <HoverNodeStyle Font-Underline="True" />
                                    <SelectedNodeStyle BackColor="White" Font-Bold="True" BorderWidth="1" />
                                </asp:TreeView>
                            </div>
                        </td>
                        <td style="width: 80%; vertical-align: top; text-align: center" class="boder">
                            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                <tr id="trModule" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td style="width: 150;" class="title">Módulo</td>
                                                            <td style="width: 150;" class="title">Sigla</td>
                                                            <td colspan="2">&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:TextBox ID="txtModuleEdit" runat="server" Width="150" MaxLength="50" onkeypress="Enter('0');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtModuleEdit" runat="server" ControlToValidate="txtModuleEdit" ErrorMessage="Favor informar o nome do módulo" SetFocusOnError="True" Display="None" ValidationGroup="Module" ></asp:RequiredFieldValidator>
                                                                <input id="txtModuleIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtInitialsEdit" runat="server" Width="150" MaxLength="4" onkeypress="Enter('0');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtInitialsEdit" runat="server" ControlToValidate="txtInitialsEdit" ErrorMessage="Favor informar a sigla do módulo" SetFocusOnError="True" Display="None" ValidationGroup="Module" ></asp:RequiredFieldValidator>
                                                            </td>
                                                            <td style="text-align: right; vertical-align: middle;">                                                                
                                                                <asp:Button ID="btnSaveModule" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click"  ValidationGroup="Module" />
                                                            </td>
                                                            <td style="text-align: right; vertical-align: middle;">                                                                
                                                                <asp:Button ID="btnNewModule" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>                                            
                                            <tr>
                                                <td style="height: 20px;">
                                                    &nbsp;
                                                </td>
                                            </tr>                                            
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="gdvModule" DataKeyNames="ModuleId" PageSize="15"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="60%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging">
                                                        <Columns>
                                                            <asp:BoundField DataField="ModuleId" HeaderText="ModuleId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="ModuleName" HeaderText="Módulo" ItemStyle-Width="70%" />
                                                            <asp:BoundField DataField="ModuleInitials" HeaderText="Sigla" ItemStyle-Width="30%" />
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvModule" runat="server" Text="Label">Não há Módulos Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="trSubModule" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td style="width: 150;" class="title">SubMódulo</td>
                                                            <td style="width: 150;" class="title">Porta</td>
                                                            <td colspan="2">&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <asp:TextBox ID="txtSubModuleEdit" runat="server" Width="150" MaxLength="50" onkeypress="Enter('1');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtSubModuleEdit" runat="server" ControlToValidate="txtSubModuleEdit" ErrorMessage="Favor informar o nome do sub módulo" SetFocusOnError="True" Display="None" ValidationGroup="SubModule" ></asp:RequiredFieldValidator>
                                                                <input id="txtSubModuleIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td>
                                                                <!--alterado [Enabled="true"] em [ID="txtPortEdit"]- esertorio - 200811171128 -->
                                                                <asp:TextBox ID="txtPortEdit" runat="server" Width="150" Enabled="true" MaxLength="5" onkeypress="Enter('1');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtPortEdit" runat="server" ControlToValidate="txtPortEdit" ErrorMessage="Favor informar a porta do sub módulo" SetFocusOnError="True" Display="None" ValidationGroup="SubModule" ></asp:RequiredFieldValidator>
                                                                <asp:CompareValidator ID="cpvtxtPortEdit" runat="server" ControlToValidate="txtPortEdit" ErrorMessage="Valor da Porta inválido" Operator="DataTypeCheck" SetFocusOnError="True" Type="Integer" Display="None" ValidationGroup="SubModule" ></asp:CompareValidator>
                                                            </td>
                                                            <td style="text-align: right; vertical-align: middle;">
                                                                <asp:Button ID="btnSaveSubModule" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="SubModule" />
                                                            </td>
                                                            <td style="text-align: right; vertical-align: middle;">
                                                                <asp:Button ID="btnNewSubModule" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px;">
                                                    &nbsp;
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="gdvSubModule" DataKeyNames="SubModuleId" PageSize="25"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="80%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging">
                                                        <Columns>
                                                            <asp:BoundField DataField="SubModuleId" HeaderText="SubModuleId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="SubModuleName" HeaderText="SubMódulo" ItemStyle-Width="70%" />
                                                            <asp:BoundField DataField="Port" HeaderText="Porta" ItemStyle-Width="30%" />
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvSubModule" runat="server" Text="Label">Não há SubMódulos Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>                                                        
                                                    </asp:GridView>
                                                </td>
                                            </tr>                                        
                                        </table>
                                    </td>
                                </tr>
                                <tr id="trService" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td style="width: 200;" class="title">Serviço</td>
                                                            <td style="width: 200;" class="title">Estado</td>
                                                            <td colspan="2">&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtServiceEdit" runat="server" Width="300" MaxLength="50" onkeypress="Enter('2');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtServiceEdit" runat="server" ControlToValidate="txtServiceEdit" ErrorMessage="Favor informar o nome do serviço" SetFocusOnError="True" Display="None" ValidationGroup="Service" ></asp:RequiredFieldValidator>
                                                                <input id="txtServiceIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td style="text-align: left;">
                                                                <asp:DropDownList ID="ddlServiceApproval" runat="server" Width="200">                                                                
                                                                    <asp:ListItem Text=":: Selecione ::" Value="-1"></asp:ListItem>
                                                                    <asp:ListItem Text="Aprovado" Value="0"></asp:ListItem>
                                                                    <asp:ListItem Text="Aguardando Aprovação" Value="1"></asp:ListItem>
                                                                </asp:DropDownList>
                                                                <asp:RequiredFieldValidator ID="rfvddlServiceApproval" runat="server" ControlToValidate="ddlServiceApproval" ErrorMessage="Favor informar o estado do serviço" SetFocusOnError="True" Display="None" ValidationGroup="Service" InitialValue="-1"></asp:RequiredFieldValidator>
                                                            </td>
                                                            <td style="text-align: left;">
                                                                <asp:Button ID="btnSaveService" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="Service" />        
                                                                <asp:Button ID="btnNewService" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td style="width: 250;" class="title">Descrição</td>
                                                            <td style="width: 250;" class="title">Protocolo(s)</td>
                                                            <td>&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtServiceDescriptionEdit" runat="server" Width="300" Rows="4" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('2');" ></asp:TextBox>
                                                            </td>
                                                            <td style="text-align: left;">
                                                                <asp:ListBox ID="lbEndPointEdit" runat="server" Width="200" Rows="4" TextMode="MultiLine" SelectionMode="Multiple" MaxLength="512" onkeypress="Enter('2');" ></asp:ListBox>
                                                                <asp:RequiredFieldValidator ID="rfvlbEndPointEdit" runat="server" ControlToValidate="lbEndPointEdit" ErrorMessage="Favor informar um protocolo" SetFocusOnError="True" Display="None" ValidationGroup="Service" ></asp:RequiredFieldValidator><!-- inc - esertorio - 200811051200 -->
                                                            </td>
                                                            <td>&nbsp;</td>                                                  
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px"></td>
                                            </tr>
                                            <tr>
                                                <td>                                                    
                                                    <asp:GridView ID="gdvService" DataKeyNames="ServiceId" PageSize="15"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="80%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging">
                                                        <Columns>
                                                            <asp:BoundField DataField="ServiceId" HeaderText="ServiceId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="ServiceName" HeaderText="Serviço" ItemStyle-Width="30%" />                                                            
                                                            <asp:BoundField DataField="Description" HeaderText="Descrição" ItemStyle-Width="30%" />
                                                            <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="EndPointsText" HeaderText="Protocolo(s)" ItemStyle-Width="30%" />
                                                            <asp:BoundField DataField="StatusApproval" HeaderText="StatusApproval" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvService" runat="server" Text="Label">Não há Serviços Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>                                        
                                        </table>
                                    </td>
                                </tr>
                                <tr id="trMethod" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td class="title">Método</td>
                                                            <td class="title">Estado</td>
                                                            <td>&nbsp</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtMethodEdit" runat="server" Width="400" MaxLength="128" onkeypress="Enter('3');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtMethodEdit" runat="server" ControlToValidate="txtMethodEdit" ErrorMessage="Favor informar o nome do método" SetFocusOnError="True" Display="None" ValidationGroup="Method" ></asp:RequiredFieldValidator>
                                                                <input id="txtMethodIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td style="text-align: left;">
                                                                <asp:DropDownList ID="ddlMethodApproval" runat="server" Width="200">
                                                                    <asp:ListItem Text=":: Selecione ::" Value="-1"></asp:ListItem>
                                                                    <asp:ListItem Text="Aprovado" Value="0"></asp:ListItem>
                                                                    <asp:ListItem Text="Aguardando Aprovação" Value="1"></asp:ListItem>
                                                                </asp:DropDownList>
                                                                <asp:RequiredFieldValidator ID="rfvddlMethodApproval" runat="server" ControlToValidate="ddlMethodApproval" ErrorMessage="Favor informar o estado do método" SetFocusOnError="True" Display="None" ValidationGroup="Method" InitialValue="-1"></asp:RequiredFieldValidator>
                                                            </td>
                                                            <td style="text-align: right;">
                                                                <asp:Button ID="btnSaveMethod" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="Method" />
                                                                <asp:Button ID="btnNewMehod" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3" class="title">Tipo</td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="3" style="text-align: left;">
                                                                <asp:TextBox ID="txtTypeEdit" runat="server" Width="700" MaxLength="200" onkeypress="Enter('3');" ></asp:TextBox>
                                                                <asp:Button ID="btnSearchReturnType" runat="server" Text="..." OnClick="btnSearchReturnType_Click" />
                                                                <ajaxToolkit:AutoCompleteExtender
                                                                    runat="server" 
                                                                    BehaviorID="AutoCompleteEx1"
                                                                    ID="AutoComplete1" 
                                                                    TargetControlID="txtTypeEdit"
                                                                    ServicePath="~/AutoComplete/AutoComplete.asmx" 
                                                                    ServiceMethod="GetCompletionList"
                                                                    MinimumPrefixLength="2" 
                                                                    CompletionInterval="1000"
                                                                    EnableCaching="true"
                                                                    CompletionSetCount="20"
                                                                    CompletionListCssClass="autocomplete_completionListElement" 
                                                                    CompletionListItemCssClass="autocomplete_listItem" 
                                                                    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                                                    DelimiterCharacters=";, :"
                                                                    ShowOnlyCurrentWordInCompletionListItem="true" >
                                                                    <Animations>
                                                                        <OnShow>
                                                                            <Sequence>
                                                                                <OpacityAction Opacity="0" />
                                                                                <HideAction Visible="true" />
                                                                                <ScriptAction Script="
                                                                                    // Cache the size and setup the initial size
                                                                                    var behavior = $find('AutoCompleteEx1');
                                                                                    if (!behavior._height) {
                                                                                        var target = behavior.get_completionList();
                                                                                        behavior._height = target.offsetHeight - 2;
                                                                                        target.style.height = '0px';
                                                                                    }" />
                                                                                
                                                                                <Parallel Duration=".4">
                                                                                    <FadeIn />
                                                                                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx1')._height" />
                                                                                </Parallel>
                                                                            </Sequence>
                                                                        </OnShow>
                                                                        <OnHide>
                                                                            <Parallel Duration=".4">
                                                                                <FadeOut />
                                                                                <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx1')._height" EndValue="0" />
                                                                            </Parallel>
                                                                        </OnHide>
                                                                    </Animations>
                                                                </ajaxToolkit:AutoCompleteExtender>
                                                                <asp:CheckBox ID="chkCollectionEdit" runat="server" Text="Coleção" Font-Bold="true" style="padding-left: 15px;"/>
                                                            </td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td class="title">Descrição</td>
                                                            <td class="title" colspan="2">Tabelas Relacionadas</td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtDescriptionMethodEdit" runat="server" Width="400" Rows="5" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('3');" ></asp:TextBox>                                                                
                                                            </td>
                                                            <td style="text-align: left;" colspan="2">
                                                                <asp:TextBox ID="txtRelatedTablesEdit" runat="server" Width="400" Rows="5" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('3');" ></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px"></td>
                                            </tr>
                                            <tr>
                                                <td>                                                
                                                    <asp:GridView ID="gdvMethod" DataKeyNames="MethodId" PageSize="10"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="95%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging" OnRowCommand="gdv_RowCommand">
                                                        <Columns>
                                                            <asp:BoundField DataField="MethodId" HeaderText="MethodId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="MethodName" HeaderText="Método" ReadOnly="true" ItemStyle-Width="30%" />
                                                            <asp:TemplateField HeaderText="Tipo Retorno" ItemStyle-Width="70%">
                                                                <ItemTemplate>                                                                    
                                                                    <asp:Label ID="lblReturnTypegdvMethod" runat="server" Text='<%# Eval("ReturnType.FullTypeName") %>' Width="95%"></asp:Label>
                                                                </ItemTemplate>                                                                
                                                            </asp:TemplateField>
                                                            <asp:BoundField DataField="Description" HeaderText="Description" ReadOnly="true" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="RelatedTables" HeaderText="RelatedTables" ReadOnly="true" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="IsReturnCollection" HeaderText="IsReturnCollection" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="StatusApproval" HeaderText="StatusApproval" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>                                                                 
                                                                    <asp:ImageButton id="imgSearchAttributes" CommandName="Open" CommandArgument='<%# Eval("ReturnType.TypeId") %>' runat="server" ImageUrl="../images/reticencias.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>                                                            
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvMethod" runat="server" Text="Label">Não há Métodos Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>                                        
                                        </table>
                                    </td>
                                </tr>
                                <tr id="trParameter" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td style="width: 400;" class="title">Parâmetro</td>
                                                            <td style="width: 400;">&nbsp;</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtParameterEdit" runat="server" Width="400" MaxLength="128" onkeypress="Enter('4');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtParameterEdit" runat="server" ControlToValidate="txtParameterEdit" ErrorMessage="Favor informar o nome do parâmetro" SetFocusOnError="True" Display="None" ValidationGroup="Parameter" ></asp:RequiredFieldValidator>
                                                                <input id="txtParameterIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td style="text-align: left;">
                                                                <asp:CheckBox ID="chkCollectionParameterEdit" runat="server" Width="200" Text="Coleção" Font-Bold="true" />
                                                                <asp:Button ID="btnSaveParameter" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="Parameter" />
                                                                <asp:Button ID="btnNewParameter" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" class="title">Tipo</td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" style="text-align: left;">
                                                                <asp:TextBox ID="txtTypeParameterEdit" runat="server" Width="800" MaxLength="200" onkeypress="Enter('4');" ></asp:TextBox>
                                                                <asp:Button ID="btnSearchType" runat="server" Text="..." OnClick="btnSearchReturnType_Click" />
                                                                <ajaxToolkit:AutoCompleteExtender
                                                                    runat="server" 
                                                                    BehaviorID="AutoCompleteEx2"
                                                                    ID="AutoComplete2" 
                                                                    TargetControlID="txtTypeParameterEdit"
                                                                    ServicePath="~/AutoComplete/AutoComplete.asmx" 
                                                                    ServiceMethod="GetCompletionList"
                                                                    MinimumPrefixLength="2" 
                                                                    CompletionInterval="1000"
                                                                    EnableCaching="true"
                                                                    CompletionSetCount="20"
                                                                    CompletionListCssClass="autocomplete_completionListElement" 
                                                                    CompletionListItemCssClass="autocomplete_listItem" 
                                                                    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                                                    DelimiterCharacters=";, :"
                                                                    ShowOnlyCurrentWordInCompletionListItem="true" >
                                                                    <Animations>
                                                                        <OnShow>
                                                                            <Sequence>
                                                                                <OpacityAction Opacity="0" />
                                                                                <HideAction Visible="true" />
                                                                                <ScriptAction Script="
                                                                                    // Cache the size and setup the initial size
                                                                                    var behavior = $find('AutoCompleteEx2');
                                                                                    if (!behavior._height) {
                                                                                        var target = behavior.get_completionList();
                                                                                        behavior._height = target.offsetHeight - 2;
                                                                                        target.style.height = '0px';
                                                                                    }" />
                                                                                
                                                                                <Parallel Duration=".4">
                                                                                    <FadeIn />
                                                                                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx2')._height" />
                                                                                </Parallel>
                                                                            </Sequence>
                                                                        </OnShow>
                                                                        <OnHide>
                                                                            <Parallel Duration=".4">
                                                                                <FadeOut />
                                                                                <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx2')._height" EndValue="0" />
                                                                            </Parallel>
                                                                        </OnHide>
                                                                    </Animations>
                                                                </ajaxToolkit:AutoCompleteExtender>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" class="title">Descrição</td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" style="text-align: left;">
                                                                <asp:TextBox ID="txtDescriptionParameterEdit" runat="server" Width="800" Rows="5" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('4');" ></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px"></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="gdvParameter" DataKeyNames="ParameterId" PageSize="10"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="95%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging" OnRowCommand="gdv_RowCommand">
                                                        <Columns>
                                                            <asp:BoundField DataField="ParameterId" HeaderText="ParameterId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="ParameterName" HeaderText="Parâmetro" ReadOnly="true" ItemStyle-Width="30%" />
                                                            <asp:TemplateField HeaderText="Tipo Parâmetro" ItemStyle-Width="70%">
                                                                <ItemTemplate>                                                                    
                                                                    <asp:Label ID="lblTypegdvParameter" runat="server" Text='<%# Eval("Type.FullTypeName") %>' Width="95%"></asp:Label>
                                                                </ItemTemplate>                                                                
                                                            </asp:TemplateField>
                                                            <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="IsCollection" HeaderText="IsCollection" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>                                                                    
                                                                    <asp:ImageButton id="imgSearchAttributes" CommandName="Open" CommandArgument='<%# Eval("Type.TypeId") %>' runat="server" ImageUrl="../images/reticencias.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvParameter" runat="server" Text="Label">Não há Parâmetros Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr id="trAttribute" runat="server">
                                    <td>
                                        <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                            <tr>
                                                <td>
                                                    <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px;">
                                                        <tr>
                                                            <td colspan="2" class="title">Atributo</td>
                                                        </tr>
                                                        <tr>
                                                            <td style="text-align: left;">
                                                                <asp:TextBox ID="txtAttributeEdit" runat="server" Width="400" MaxLength="128" onkeypress="Enter('6');" ></asp:TextBox>
                                                                <asp:RequiredFieldValidator ID="rfvtxtAttributeEdit" runat="server" ControlToValidate="txtAttributeEdit" ErrorMessage="Favor informar o nome do atributo" SetFocusOnError="True" Display="None" ValidationGroup="Attribute" ></asp:RequiredFieldValidator>
                                                                <input id="txtAttributeIdEdit" type="hidden" runat="server" />
                                                            </td>
                                                            <td style="text-align: left;">                                                                
                                                                <asp:Button ID="btnSaveAttribute" runat="server" Text="Salvar" Width="80" OnClick="btnSave_Click" ValidationGroup="Attribute" />
                                                                <asp:Button ID="btnNewAttribute" runat="server" Text="Novo" Width="80" OnClick="btnNew_Click" CausesValidation="false" />
                                                            </td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" class="title">Tipo</td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" style="text-align: left;">
                                                                <asp:TextBox ID="txtTypeAttributeEdit" runat="server" Width="800" MaxLength="200" onkeypress="Enter('6');" ></asp:TextBox>
                                                                <asp:Button ID="Button2" runat="server" Text="..." OnClick="btnSearchReturnType_Click" />
                                                                <ajaxToolkit:AutoCompleteExtender
                                                                    runat="server" 
                                                                    BehaviorID="AutoCompleteEx3"
                                                                    ID="AutoComplete3" 
                                                                    TargetControlID="txtTypeAttributeEdit"
                                                                    ServicePath="~/AutoComplete/AutoComplete.asmx" 
                                                                    ServiceMethod="GetCompletionList"
                                                                    MinimumPrefixLength="2" 
                                                                    CompletionInterval="1000"
                                                                    EnableCaching="true"
                                                                    CompletionSetCount="20"
                                                                    CompletionListCssClass="autocomplete_completionListElement" 
                                                                    CompletionListItemCssClass="autocomplete_listItem" 
                                                                    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                                                    DelimiterCharacters=";, :"
                                                                    ShowOnlyCurrentWordInCompletionListItem="true" >
                                                                    <Animations>
                                                                        <OnShow>
                                                                            <Sequence>
                                                                                <OpacityAction Opacity="0" />
                                                                                <HideAction Visible="true" />
                                                                                <ScriptAction Script="
                                                                                    // Cache the size and setup the initial size
                                                                                    var behavior = $find('AutoCompleteEx3');
                                                                                    if (!behavior._height) {
                                                                                        var target = behavior.get_completionList();
                                                                                        behavior._height = target.offsetHeight - 2;
                                                                                        target.style.height = '0px';
                                                                                    }" />
                                                                                
                                                                                <Parallel Duration=".4">
                                                                                    <FadeIn />
                                                                                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx3')._height" />
                                                                                </Parallel>
                                                                            </Sequence>
                                                                        </OnShow>
                                                                        <OnHide>
                                                                            <Parallel Duration=".4">
                                                                                <FadeOut />
                                                                                <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx3')._height" EndValue="0" />
                                                                            </Parallel>
                                                                        </OnHide>
                                                                    </Animations>
                                                                </ajaxToolkit:AutoCompleteExtender>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td style="height: 10px"></td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" class="title">Descrição</td>                                                            
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" style="text-align: left;">
                                                                <asp:TextBox ID="txtDescriptionAttributeEdit" runat="server" Width="800" Rows="5" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('6');" ></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 20px"></td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <asp:GridView ID="gdvAttribute" DataKeyNames="AttributeId" PageSize="10"
                                                        AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                        BorderStyle="None" Width="95%" CellPadding="2" BorderWidth="0" 
                                                        OnRowDeleting="gdv_RowDeleting" OnRowDataBound="gdv_RowDataBound" 
                                                        OnPageIndexChanging="gdv_PageIndexChanging" OnRowCommand="gdv_RowCommand">
                                                        <Columns>
                                                            <asp:BoundField DataField="AttributeId" HeaderText="AttributeId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                            <asp:BoundField DataField="AttributeName" HeaderText="Atributo" ReadOnly="true" ItemStyle-Width="30%" />
                                                            <asp:TemplateField HeaderText="Tipo Atributo" ItemStyle-Width="70%">
                                                                <ItemTemplate>                                                                    
                                                                    <asp:Label ID="lblTypegdvAttribute" runat="server" Text='<%# Eval("Type.FullTypeName") %>' Width="95%"></asp:Label>
                                                                </ItemTemplate>                                                                
                                                            </asp:TemplateField>
                                                            <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />                                                            
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField ItemStyle-Width="5%">
                                                                <ItemTemplate>                                                                    
                                                                    <asp:ImageButton id="imgSearchAttributes" CommandName="Open" CommandArgument='<%# Eval("Type.TypeId") %>' runat="server" ImageUrl="../images/reticencias.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                <ItemTemplate>
                                                                    <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                </ItemTemplate>
                                                            </asp:TemplateField>
                                                        </Columns>
                                                        <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                        <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                        <EmptyDataTemplate>
                                                            <p style="text-align: center; font-weight: bold;">
                                                                <asp:Label ID="lblItensgdvAttribute" runat="server" Text="Label">Não há Atributos Cadastrados.</asp:Label>
                                                            </p>
                                                        </EmptyDataTemplate>
                                                    </asp:GridView>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                
                <asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Search" />
                <asp:ValidationSummary ID="ValidationSummary2" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Module" />
                <asp:ValidationSummary ID="ValidationSummary3" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="SubModule" />
                <asp:ValidationSummary ID="ValidationSummary4" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Service" />
                <asp:ValidationSummary ID="ValidationSummary5" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Method" />
                <asp:ValidationSummary ID="ValidationSummary6" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Parameter" />
                <asp:ValidationSummary ID="ValidationSummary7" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="Attribute" />
                <asp:ValidationSummary ID="ValidationSummary8" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="TypePopup" />
                <asp:ValidationSummary ID="ValidationSummary9" runat="server" DisplayMode="List" ShowMessageBox="True" ShowSummary="False" ValidationGroup="AttributePopup" />
                
                <div id="divBackground" class="modalBackground"></div>
                <div id="divType" class="modalPopup">
                    <table align="left" cellpadding="10" cellspacing="10" border="0" class="table">                                    
                        <tr style="height: 90%">
                            <td class="boder" style="vertical-align: top;">
                                <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                    <tr>
                                        <td>
                                            <table cellpadding="0" cellspacing="0" border="0" style="width: 100%; vertical-align: top; text-align: center">
                                                <tr>
                                                    <td style="text-align: center;">
                                                        <table cellpadding="0" cellspacing="0" border="0">
                                                            <tr>
                                                                <td colspan="2" class="title">
                                                                    Tipo
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" style="text-align: left;">
                                                                    <asp:TextBox ID="txtTypeEditPopup" runat="server" Width="700" onkeypress="Enter('7');"></asp:TextBox>
                                                                    <asp:RequiredFieldValidator ID="rfvtxtTypeEditPopup" runat="server" ControlToValidate="txtTypeEditPopup"
                                                                        ErrorMessage="Favor informar o nome do tipo" SetFocusOnError="True" Display="None"
                                                                        ValidationGroup="TypePopup"></asp:RequiredFieldValidator>                                                                    
                                                                    <input id="txtTypeIdEditPopup" type="hidden" runat="server" />
                                                                </td>                                                                
                                                            </tr>
                                                            <tr>
                                                                <td style="height: 10px"></td>
                                                            </tr>
                                                            <tr>
                                                                <td colspan="2" class="title">
                                                                    Descrição
                                                                </td>
                                                            </tr>                                                            
                                                            <tr>
                                                                <td style="text-align: left;">
                                                                    <asp:TextBox ID="txtTypeDescriptionEditPopup" runat="server" Width="600" Rows="4" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('7');" ></asp:TextBox>
                                                                    <asp:RequiredFieldValidator ID="rfvtxtTypeDescriptionEditPopup" runat="server" ControlToValidate="txtTypeDescriptionEditPopup"
                                                                        ErrorMessage="Favor informar a descrição do tipo" SetFocusOnError="True" Display="None"
                                                                        ValidationGroup="TypePopup"></asp:RequiredFieldValidator>
                                                                </td>
                                                                <td style="text-align: right; vertical-align: middle;">
                                                                    <table cellpadding="0" cellspacing="0" border="0">
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Button ID="btnSearchPopup" runat="server" Text="Pesquisar" Width="80" OnClick="btnSearchPopupType_Click" />        
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Button ID="btnSaveTypePopup" runat="server" Text="Salvar" Width="80" OnClick="btnSavePopupType_Click" ValidationGroup="TypePopup" />    
                                                                            </td>
                                                                        </tr>
                                                                        <tr>
                                                                            <td>
                                                                                <asp:Button ID="btnNewTypePopup" runat="server" Text="Novo" Width="80" OnClick="btnNewPopupType_Click" CausesValidation="false" />    
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </td>                                                                
                                                            </tr>
                                                        </table>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="height: 20px;">
                                                        &nbsp;
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td>
                                                        <asp:GridView ID="gdvTypePopup" DataKeyNames="TypeId" PageSize="15" AutoGenerateColumns="False"
                                                            AllowSorting="true" AllowPaging="true" runat="server" BorderStyle="None" Width="95%"
                                                            CellPadding="2" BorderWidth="0" OnRowDeleting="gdvPopupType_RowDeleting" OnRowDataBound="gdv_RowDataBound"
                                                            OnPageIndexChanging="gdvPopupType_PageIndexChanging" OnRowCommand="gdv_RowCommand">
                                                            <Columns>
                                                                <asp:BoundField DataField="TypeId" HeaderText="TypeId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                                <asp:BoundField DataField="FullTypeName" HeaderText="FullTypeName" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                                <asp:TemplateField HeaderText="Tipo" ItemStyle-Width="90%">
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblTypegdvType" runat="server" Text='<%# Eval("FullTypeName") %>'
                                                                            Width="95%"></asp:Label>
                                                                    </ItemTemplate>
                                                                    <EditItemTemplate>
                                                                        <asp:TextBox ID="txtTypegdvType" runat="server" Text='<%# Bind("FullTypeName") %>'
                                                                            Width="95%"></asp:TextBox>
                                                                    </EditItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:BoundField DataField="Description" HeaderText="Descrição"  ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                                <asp:TemplateField ItemStyle-Width="5%">
                                                                    <ItemTemplate>
                                                                        <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField ItemStyle-Width="5%">
                                                                    <ItemTemplate>
                                                                        <asp:ImageButton id="imgSearchAttributes" CommandName="Open" CommandArgument='<%# Eval("TypeId") %>' runat="server" ImageUrl="../images/reticencias.gif" />
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                                <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                                    <ItemTemplate>
                                                                        <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                                    </ItemTemplate>
                                                                </asp:TemplateField>
                                                            </Columns>
                                                            <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                            <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                            <EmptyDataTemplate>
                                                                <p style="text-align: center; font-weight: bold;">
                                                                    <asp:Label ID="lblItensgdvType" runat="server" Text="Label">Não há Tipos Cadastrados.</asp:Label>
                                                                </p>
                                                            </EmptyDataTemplate>
                                                        </asp:GridView>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>                                        
                                    </tr>                                    
                                </table>
                            </td>
                        </tr>
                        <tr style="height: 10px;">
                            <td style="text-align: right; padding: 0px;background-color: #dddddd;">
                                <asp:Button ID="btnClosePopup" runat="server" Text="Fechar" Width="80" CausesValidation="false" OnClick="btnClosePopup_Click" />
                            </td>
                        </tr>
                    </table>
                </div>
                <div id="divAttribute" class="modalPopup">
                    <table align="left" cellpadding="10" cellspacing="10" border="0" class="table">                                    
                        <tr style="height: 90%">
                            <td class="boder" style="vertical-align: top;">
                                <table cellpadding="0" cellspacing="0" border="0" style="vertical-align: top; width: 100%; text-align: center">
                                    <tr>
                                        <td style="text-align: center;">
                                            <table cellpadding="0" cellspacing="0" border="0" style="padding-right: 10px">
                                                <tr>
                                                    <td colspan="2" class="title">Atributo</td>
                                                </tr>
                                                <tr>
                                                    <td style="text-align: left;">
                                                        <asp:TextBox ID="txtAttributeEditPopup" runat="server" Width="500" MaxLength="128" onkeypress="Enter('8');" ></asp:TextBox>
                                                        <asp:RequiredFieldValidator ID="rfvtxtAttributeEditPopup" runat="server" ControlToValidate="txtAttributeEditPopup" ErrorMessage="Favor informar o nome do atributo" SetFocusOnError="True" Display="None" ValidationGroup="AttributePopup" ></asp:RequiredFieldValidator>
                                                        <input id="txtAttributeIdEditPopup" type="hidden" runat="server" />
                                                    </td>
                                                    <td style="text-align: right;">                                                                
                                                        <asp:Button ID="btnSaveAttributePopup" runat="server" Text="Salvar" Width="80" OnClick="btnSavePopupAttribute_Click" ValidationGroup="AttributePopup" />
                                                        <asp:Button ID="btnNewAttributePopup" runat="server" Text="Novo" Width="80" OnClick="btnNewPopupAttribute_Click" CausesValidation="false" />
                                                    </td>                                                            
                                                </tr>
                                                <tr>
                                                    <td style="height: 10px"></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" class="title">Tipo</td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align: left;">
                                                        <asp:TextBox ID="txtTypeAttributeEditPopup" runat="server" Width="630" MaxLength="200" onkeypress="Enter('8');" ></asp:TextBox>
                                                        <asp:Button ID="Button1" runat="server" Text="..." OnClick="btnSearchReturnType_Click" />
                                                        <ajaxToolkit:AutoCompleteExtender
                                                            runat="server" 
                                                            BehaviorID="AutoCompleteEx4"
                                                            ID="AutoComplete4" 
                                                            TargetControlID="txtTypeAttributeEditPopup"
                                                            ServicePath="~/AutoComplete/AutoComplete.asmx" 
                                                            ServiceMethod="GetCompletionList"
                                                            MinimumPrefixLength="2" 
                                                            CompletionInterval="1000"
                                                            EnableCaching="true"
                                                            CompletionSetCount="20"
                                                            CompletionListCssClass="autocomplete_completionListElement" 
                                                            CompletionListItemCssClass="autocomplete_listItem" 
                                                            CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem"
                                                            DelimiterCharacters=";, :"
                                                            ShowOnlyCurrentWordInCompletionListItem="true" >
                                                            <Animations>
                                                                <OnShow>
                                                                    <Sequence>
                                                                        <OpacityAction Opacity="0" />
                                                                        <HideAction Visible="true" />
                                                                        <ScriptAction Script="
                                                                            // Cache the size and setup the initial size
                                                                            var behavior = $find('AutoCompleteEx4');
                                                                            if (!behavior._height) {
                                                                                var target = behavior.get_completionList();
                                                                                behavior._height = target.offsetHeight - 2;
                                                                                target.style.height = '0px';
                                                                            }" />
                                                                        
                                                                        <Parallel Duration=".4">
                                                                            <FadeIn />
                                                                            <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx4')._height" />
                                                                        </Parallel>
                                                                    </Sequence>
                                                                </OnShow>
                                                                <OnHide>
                                                                    <Parallel Duration=".4">
                                                                        <FadeOut />
                                                                        <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx4')._height" EndValue="0" />
                                                                    </Parallel>
                                                                </OnHide>
                                                            </Animations>
                                                        </ajaxToolkit:AutoCompleteExtender>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="height: 10px"></td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" class="title">Descrição</td>                                                            
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="text-align: left;">
                                                        <asp:TextBox ID="txtDescriptionAttributeEditPopup" runat="server" Width="650" Rows="5" TextMode="MultiLine" MaxLength="512" onkeypress="Enter('8');" ></asp:TextBox>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="height: 20px"></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:GridView ID="gdvAttributePopup" DataKeyNames="AttributeId" PageSize="15"
                                                AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" runat="server"
                                                BorderStyle="None" Width="95%" CellPadding="2" BorderWidth="0" 
                                                OnRowDeleting="gdvPopupAttribute_RowDeleting" OnRowDataBound="gdv_RowDataBound"
                                                OnPageIndexChanging="gdvPopupAttribute_PageIndexChanging" OnRowCommand="gdv_RowCommand">
                                                <Columns>
                                                    <asp:BoundField DataField="AttributeId" HeaderText="AttributeId" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />
                                                    <asp:BoundField DataField="AttributeName" HeaderText="Atributo" ReadOnly="true" ItemStyle-Width="30%" />
                                                    <asp:TemplateField HeaderText="Tipo Atributo" ItemStyle-Width="70%">
                                                        <ItemTemplate>                                                                    
                                                            <asp:Label ID="lblTypegdvAttributePopup" runat="server" Text='<%# Eval("Type.FullTypeName") %>' Width="95%"></asp:Label>
                                                        </ItemTemplate>                                                                
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="Description" HeaderText="Description" ItemStyle-CssClass="visibility" HeaderStyle-CssClass="visibility" />                                                            
                                                    <asp:TemplateField ItemStyle-Width="5%">
                                                        <ItemTemplate>
                                                            <img id="imgItemDivergent" src="../images/item_divergent.gif" alt="" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:TemplateField ItemStyle-Width="5%">
                                                        <ItemTemplate>                                                                    
                                                            <asp:ImageButton id="imgSearchAttributes" CommandName="Open" CommandArgument='<%# Eval("Type.TypeId") %>' runat="server" ImageUrl="../images/reticencias.gif" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>                                                    
                                                    <asp:TemplateField HeaderText="Excluir" ItemStyle-Width="5%">
                                                        <ItemTemplate>
                                                            <asp:ImageButton ID="btnDelete" runat="server" CommandName="Delete" ImageUrl="../images/icon-delete.gif" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                </Columns>
                                                <RowStyle BorderStyle="None" CssClass="rowgrid" />
                                                <HeaderStyle CssClass="grid-header"></HeaderStyle>
                                                <EmptyDataTemplate>
                                                    <p style="text-align: center; font-weight: bold;">
                                                        <asp:Label ID="lblItensgdvAttributePopup" runat="server" Text="Label">Não há Atributos Cadastrados.</asp:Label>
                                                    </p>
                                                </EmptyDataTemplate>
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr style="height: 10px;">
                            <td style="text-align: right; padding: 0px;background-color: #dddddd;">
                                <asp:Button ID="Button5" runat="server" Text="Fechar" Width="80" CausesValidation="false" OnClick="btnClosePopup_Click" />
                            </td>
                        </tr>
                    </table>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgressService" runat="server">
            <ProgressTemplate>
                <div class="divProcessando">Processando...</div>
            </ProgressTemplate>
        </asp:UpdateProgress>
    </form>
</body>
</html>